package com.yinhe.music.yhmusic.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yinhe.music.common.GlideHelper.GlideHelper;
import com.yinhe.music.yhmusic.R;
import com.yinhe.music.yhmusic.model.RadioListInfo;

/**
 * Created by hasee on 2017/8/15.
 */

public class RadioListAdapter extends BaseQuickAdapter<RadioListInfo, BaseViewHolder> {

    public RadioListAdapter() {
        super(R.layout.fragment_radio_item);
    }

    @Override
    protected void convert(BaseViewHolder helper, RadioListInfo item) {
        if (item.getNickname() == null) {
            helper.setVisible(R.id.anchor, false);
        }
        helper.setText(R.id.radio_name, item.getRadioName())
                .setText(R.id.radio_play, String.valueOf(item.getPlayNum()))
                .setText(R.id.anchor, "主播：" + item.getNickname())
                .setText(R.id.introduction, item.getIntro())
                .setText(R.id.update_date, item.getUpdateTime() + "更新");
        ImageView image = helper.getView(R.id.radio_image);
        GlideHelper.setImageResource(image, item.getImage(), R.drawable.default_cover);
    }
}
